﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApplication1;

namespace znq
{
    public partial class AxisControl : Form
    {
        Form1 main;
        public AxisControl(Form1 m)
        {
            InitializeComponent();
            main = m;
            setAttribute();
        }

        //初始化属性值
        private void setAttribute() 
        {
            numericUpDown9.Value = decimal.Parse(main.axis_x_min.ToString());
            numericUpDown10.Value = decimal.Parse(main.axis_x_max.ToString());
            numericUpDown11.Value = main.axis_y_min;
            numericUpDown12.Value = main.axis_y_max;
        }

        //图形的X轴最小值调整
        private void numericUpDown9_ValueChanged(object sender, EventArgs e)
        {
            double xMin = double.Parse(numericUpDown9.Value.ToString());
            main.axis_x_min = xMin;
            main.setAxis();
        }

        //图形的X轴最大值调整
        private void numericUpDown10_ValueChanged(object sender, EventArgs e)
        {
            double xMax = double.Parse(numericUpDown10.Value.ToString());
            main.axis_x_max = xMax;
            main.setAxis();
        }

        //图形的Y轴最小值调整
        private void numericUpDown11_ValueChanged(object sender, EventArgs e)
        {
            int yMin = int.Parse(numericUpDown11.Value.ToString());
            main.axis_y_min = yMin;
            main.setAxis();
        }

        //图形的Y轴最大值调整
        private void numericUpDown12_ValueChanged(object sender, EventArgs e)
        {
            int yMax = int.Parse(numericUpDown12.Value.ToString());
            main.axis_y_max = yMax;
            main.setAxis();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
